<!DOCTYPE html>
<html style="height: 100%;width: 100%">
<head>
    <meta charset="utf-8">
    <title>数据上传</title>
    <link rel="stylesheet" href="/up/bootstrap/bootstrap.min.css">
    <script src="/up/bootstrap/jquery.min.js"></script>
    <script src="/up/bootstrap/bootstrap.min.js"></script>
    <style type="text/css">
        #topDiv{
            position: absolute;
            z-index: 100;
            height: 400px;
            width: 500px;
            left: 40%;
            top: 50%;
        }
        .formStyle{
            margin-top: 30px;
            width: 70%;
        }
    </style>

</head>
<body style="height: 100%;width: 100%;">

<img id="img" src="/up/bootstrap/bg.png" style="height: 100%;width: 100%;">

<div id="topDiv">
    <div class="container">
        <input type="text" class="form-control formStyle" id="username" placeholder="请输入姓名" />
    </div>
    <div class="container">
        <input type="password" class="form-control formStyle" id="password" placeholder="请输入密码" />
    </div>
    <button type="button" class="btn btn-success btn-lg"
            style="float :left;margin-left: 3%;margin-top: 20px" onclick="login();">登录</button>
    <button type="button" class="btn btn-success btn-lg"
            style="margin-left: 35%;margin-top: 20px" onclick="cancel();">取消</button>

</div>

</body>
<script>
    function cancel(){
        $("#username").val("");
        $("#password").val("");
    }
    function login(){
        debugger
        var username = $("#username").val();
        var password = $("#password").val();
        var userVo1 = {"username":username,"password":password}
        $.ajax({
            type: 'post',
            url: '/up/report/loginIn',
            dataType: "json",
            contentType : 'application/json;charset=utf-8',
            data:  JSON.stringify(userVo1),
            cache: false,
            success: function(data){
                if (data.code==200){
                    window.localStorage.setItem("report-token",data.token);
                    window.location = './doc'
                }
                if (data.code==9999){
                    alert(data.msg)
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert(textStatus);
            },
        })

    }
    function showDiv() {
        document.getElementById('popWindow').style.display = 'block';
        document.getElementById('maskLayer').style.display = 'block';
    }
    function closeDiv() {
        document.getElementById('popWindow').style.display = 'none';
        document.getElementById('maskLayer').style.display = 'none';
    }

</script>
</html>